package cn.meomis.common.util;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 * @author SkyKong
 * @email xiangcheng.kong@hp.com
 */
public class SpringApplicationContext implements ApplicationContextAware {

	private static ApplicationContext appContext;

	//Private constructor prevents instantiation from other classes
	private SpringApplicationContext() {
	}

	@Override
	public void setApplicationContext(ApplicationContext applicationContext)
			throws BeansException {
		appContext = applicationContext;

	}

	public static Object getBean(String beanName) {
		return appContext.getBean(beanName);
	}

}
